Skip to content

fix(#183): implement subscription dunning management#492

Open
rindicomfort wants to merge 2 commits into
Smartdevs17:mainfrom
rindicomfort:fix/183-dunning-management
Open

fix(#183): implement subscription dunning management#492
rindicomfort wants to merge 2 commits into
Smartdevs17:mainfrom
rindicomfort:fix/183-dunning-management

Conversation

@rindicomfort
Copy link
Copy Markdown
Contributor

Summary

Closes #183

Implements a comprehensive dunning (failed-payment recovery) system with automated retry scheduling, tiered notifications, escalation to human review, manual override, and a React Native dashboard.

Files

src/store/dunningStore.ts (new)

Zustand store persisted to AsyncStorage (subtrackr-dunning):

Method Description
startDunning Creates a DunningEntry at the retry stage
recordPaymentAttempt(id, success) Advances stage on failure; removes entry on success
escalateToSupport Moves to suspend, pauses retries, logs in_app comm for human review
overrideDunning CS manual resolution: resolved / waived / cancelled
pauseDunning / resumeDunning Operational controls
overrideStage Jump to any stage directly
configurePlan Per-plan DunningConfiguration override
getAnalytics Live stage breakdown + recovery rate

Retry schedule (days): 1 → 3 → 7 → 14 (exported as RETRY_SCHEDULE_DAYS)

Notification tiers: email → push → in_app (SMS-ready via config channels)

Grace period: configurable suspendAfterDays / cancelAfterDays in DunningConfiguration

src/screens/DunningDashboard.tsx (new)

React Native dashboard:

  • Analytics bar: active count, per-stage breakdown, recovery %
  • Retry schedule chips: days 1 / 3 / 7 / 14
  • Filter chips: All / Retrying / Warning / Suspended / Cancelled
  • Entry cards: stage badge, failed-attempt count, next-action countdown, paused indicator
  • Detail bottom-sheet per entry:
    • Full info rows + notification log
    • Stage override chips
    • Actions: Pause/Resume, Manual Payment Override, Escalate to Support, Mark Resolved, Waive & Remove

Supporting changes

  • src/store/index.ts — exports useDunningStore
  • src/navigation/types.ts — adds DunningDashboard route
  • src/navigation/AppNavigator.tsx — registers DunningDashboard screen

Acceptance Criteria

  • DunningSequence: retry_schedule, notification tiers, escalation trigger
  • Automatic retry with configurable schedule (days 1, 3, 7, 14)
  • Notification tier: email → push → in_app (SMS via config)
  • Grace period before suspension (suspendAfterDays)
  • Manual payment override by customer service
  • Escalation to human review after max retries
  • Dunning analytics and recovery rates
  • React Native dunning dashboard

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@rindicomfort Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

…tion

- Add src/store/dunningStore.ts: Zustand persisted store backed by
  AsyncStorage with full dunning lifecycle:
  - startDunning: creates a new DunningEntry at the retry stage
  - recordPaymentAttempt(success): advances stage on failure using
    configurable retry schedule (days 1, 3, 7, 14); removes entry on
    success (payment recovered)
  - escalateToSupport: moves to suspend stage, pauses automated
    retries, logs in_app communication for human review
  - overrideDunning: customer-service manual resolution (resolved /
    waived / cancelled)
  - pauseDunning / resumeDunning / overrideStage: operational controls
  - configurePlan: per-plan DunningConfiguration override
  - getAnalytics: live breakdown by stage + recovery rate
- Export RETRY_SCHEDULE_DAYS = [1, 3, 7, 14] for UI consumption
- Export useDunningStore from src/store/index.ts
- Add DunningDashboard route to RootStackParamList
- Add src/screens/DunningDashboard.tsx:
  - Analytics bar: active count, per-stage breakdown, recovery %
  - Retry schedule chips showing days 1 / 3 / 7 / 14
  - Filter chips: All / Retrying / Warning / Suspended / Cancelled
  - FlatList of DunningEntry cards with stage badge, failed-attempt
    count, next-action countdown, and paused indicator
  - Bottom-sheet detail panel per entry:
    - Full info rows (stage, attempts, timestamps, status)
    - Notification log (channel, stage, timestamp)
    - Stage override chips (retry / warn / suspend / cancel)
    - Actions: Pause/Resume, Manual Payment Override, Escalate to
      Support, Mark Resolved, Waive & Remove
- Register DunningDashboard in AppNavigator (SettingsStack)
@rindicomfort rindicomfort force-pushed the fix/183-dunning-management branch from 10b1ed1 to e5a1ccf Compare June 1, 2026 07:22
@Smartdevs17
Copy link
Copy Markdown
Owner

⚠️ Merge failed — check CI status.

🤖 Drips Wave Merge Agent

@Smartdevs17
Copy link
Copy Markdown
Owner

❌ This PR has merge conflicts.

Hi @rindicomfort,

Please resolve the conflicts with main so this can be merged.


🤖 Drips Wave Merge Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement subscription dunning management for failed payments

2 participants